Skip to content

Exporting the 3d view as text#1

Open
AnarchistHoneybun wants to merge 3 commits intomainfrom
features/export
Open

Exporting the 3d view as text#1
AnarchistHoneybun wants to merge 3 commits intomainfrom
features/export

Conversation

@AnarchistHoneybun
Copy link
Collaborator

for like, textual image representations in websites and stuff

- Add /export command to save current 3D view to file
- Implement content-aware trimming with 2-char margin
- Fix success/error message display and ESC handling
- Export uses single newlines for web compatibility
- Add ExportFormat enum (Plain, Color, Html)
- /export: plain text format (default, no colors)
- /export --color: ANSI colored text format
- /export --html: self-contained HTML format for web embedding
- Support filename arguments with format flags
- Update help documentation for new export options
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds functionality to export the 3D view as text in multiple formats for use in websites and other applications. The export command supports plain text, colored text with ANSI codes, and self-contained HTML formats.

Key changes:

  • Added export command with flexible syntax supporting different output formats
  • Implemented three export formats: plain text, ANSI colored text, and HTML
  • Added success message display system to complement existing error messages

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/main.rs Added export command handling, success message system, and updated command execution flow
src/graphics.rs Implemented export functionality with three format options and text trimming utilities
src/args.rs Updated help documentation to include export command usage examples

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +133 to +136
let timestamp = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs();
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timestamp generation logic is duplicated in multiple branches. Consider extracting this into a helper function to reduce code duplication.

Copilot uses AI. Check for mistakes.
self.trim_output_with_margin(rows_output, 2)
}

fn export_color(&self) -> String {
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export_color and export_html methods contain nearly identical logic for processing Braille pixels and colors. Consider extracting the common pixel processing logic into a shared helper method to reduce code duplication.

Copilot uses AI. Check for mistakes.
self.trim_output_with_margin(rows_output, 2)
}

fn export_html(&self) -> String {
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export_color and export_html methods contain nearly identical logic for processing Braille pixels and colors. Consider extracting the common pixel processing logic into a shared helper method to reduce code duplication.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants